<#include "/common/head.html"/>

 <div class="easyui-panel updatePage" data-options="fit:true,border:false">
    <form id="ff" class="easyui-form" method="post">
    		<input  type="hidden" name="instorage_id" value="${model.instorage_id!''}" />
        <table class="table1">
        	
            <tr>
           		<th><span>物料编号：</span></th>
               	<td colspan="4">
               		<input class="easyui-textbox" type="text" id="mat_no" name="mat_no" value="${model.mat_no!''}" data-options=""></input>
           		</td>           		
            </tr>
            <tr>
           		<th><span>物料名：</span></th>
               	<td>
               		<input class="easyui-textbox" type="text" id="mat_name" name="mat_name" value="${model.mat_name!''}" data-options=""></input>
           		</td>
           		
           		<th><span>规格：</span></th>
               	<td>
               		<input class="easyui-textbox" type="text" id="mat_std" name="mat_std" value="${model.mat_std!''}" data-options=""></input>
           		</td>
           		
            </tr>
            <tr>
           		<th><span>计量单位：</span></th>
               	<td>
	            	<input class="easyui-combobox" id="mat_unit" name="mat_unit" value="${model.mat_unit!''}" data-options="
	            				valueField: 'id',
   								textField: 'text',
	            				data: [
	            					{id:'', text:''}<#list dictDataunit_name.keySet() as key>,{id:'${key}', text:'${dictDataunit_name.get(key)}'}</#list>
	            				]
	            				
	            	" />        	
           		</td>
           		<th><span>数量：</span></th>
               	<td>
               		<input class="easyui-textbox" type="text" id="mat_num" name="mat_num" value="${model.mat_num!''}" data-options=""></input>
           		</td>
           		
            </tr>
            <tr>
           		<th><span>单价：</span></th>
               	<td>
               		<input class="easyui-textbox" type="text" id="mat_price" name="mat_price" value="${model.mat_price!''}" data-options=""></input>
           		</td>
           		
           		<th><span>金额：</span></th>
               	<td>
               		<input class="easyui-textbox" type="text" id="mat_sum" name="mat_sum" value="${model.mat_sum!''}" data-options=""></input>
           		</td>
           		
            </tr>
        </table>
    </form>
</div>
<script>
top.window.subPage.save = save;
function save() {
	if($("#zcurdHeadTable").form('validate')) {
		$.post("update", getParam(), function(data) {
			top.window.closeWindow();
			top.window.subPage.loadCurrDatagrid();
		});
	}
}
function getParam() {
	var param = {
	     
	    "id": ${model.id}, 
       	    "model.instorage_id": getInputValue("instorage_id"), 
       	    "model.mat_no": getInputValue("mat_no"), 
       	    "model.mat_name": getInputValue("mat_name"), 
       	    "model.mat_std": getInputValue("mat_std"), 
       	    "model.mat_unit": getInputValue("mat_unit"), 
       	    "model.mat_num": getInputValue("mat_num"), 
       	    "model.mat_price": getInputValue("mat_price"), 
       	    "model.mat_sum": getInputValue("mat_sum"), 
	}
	for(key in param) {
		if(!param[key]) {
			delete param[key];
		}
	}
	return param;
}
$(function() {  
	if($("#mat_price").val!=''){
		$("input",$("#mat_price").next("span")).blur(function(){
			 $("#mat_sum").textbox("setValue",$("#mat_num").val()*$("#mat_price").val());   
	    }); 
	}
	if($("#mat_num").val!=''){
		$("input",$("#mat_num").next("span")).blur(function(){
			 $("#mat_sum").textbox("setValue",$("#mat_num").val()*$("#mat_price").val());   
	    }); 
	}
});  
//扩展js
</script>
<#include "/busi/wms/material/material_select.html"/>
<#include "/common/foot.html"/>
